﻿Imports System.Text.RegularExpressions
Public Class FrmModifDepannage

#Region "Champs"
    Dim position As Integer = 0
    Dim idinter As Integer
    Dim idi As String
    Dim idc As String
    Dim nom As String
    Dim pre As String
    Dim rue As String
    Dim cp As String
    Dim vil As String
    Dim telpor As String
    Dim telfixe As String
    Dim email As String
    Dim dtAp As String
    Dim dtDI As String
    Dim dtFI As String
    Dim dtLi As String
    Dim typInterv As String
    Dim typPC As String
    Dim lieu As String
    Dim pb As String
    Dim mat As String
    Dim tra As String
    Dim rencomp As String
    Dim IdCli As String
    Dim TypInt As String
    Dim LieuInt As String
    Dim TypePC As String
    Dim idParCli As String
    Dim macnx As New PPE3.ClassMySqlConnect("853339_depanneur", "071064")
    Dim nbchamps As Integer = 0
#End Region

    Private Sub FrmModifDepannage_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Me.MdiParent = FrmStart
        Me.Top = 0
        Me.Left = 0
        TextBoxId.Text = "0"
        idParCli = TextBoxId.Text Is DBNull.Value
        ' SeConnecter()
        'macnx.Se_Connecter_MySqlServer()
        'macnx.Executer_Requete_Select("SELECT client.IdClient,intervention.IdIntervention,NomClient,Prenomclient,AdresseClient,CodePostalClient,VilleClient,TelPortClient,TelFixeClient,EmailClient,RenseignementCompAdresse,TypeIntervention,TypeMateriel,Lieu, EnonceProbleme,MaterielsDeposes,TravauxEffectues,DateHeureReception,DateHeureDebIntervention,DateHeureFinIntervention,dateHeureLivraison FROM Client,date,intervention Where IdClient like '" & "%" & idParCli & "%" & "' ")
        ''MonJeuDeDonnees.Tables("ModifDepannage").Clear()
        'macnx.Se_Deconnecter_MySqlServer()
        btnModif.BackColor = Color.Red
        LblinfoModif.ForeColor = Color.Red

        'If TextBoxId.Text = "0" Then
        '    Clear()
        'Else

        '    'macnx.Executer_Requete_Select("SELECT SELECT client.IdClient,intervention.IdIntervention,NomClient,Prenomclient,AdresseClient,CodePostalClient,VilleClient,TelPortClient,TelFixeClient,EmailClient,RenseignementCompAdresse,TypeIntervention,TypeMateriel,Lieu, EnonceProbleme,MaterielsDeposes,TravauxEffectues,DateHeureReception,DateHeureDebIntervention,DateHeureFinIntervention,dateHeureLivraison FROM Client,date,intervention ")
        '    'macnx.Se_Deconnecter_MySqlServer()
        '    'MonJeuDeDonnees.Tables("ModifDepannage").Clear()
        '    FrmRechercheClientModif.RafraichirModifDep()
        'End If


    End Sub


#Region " Méthode()"
    'Méthode pour vider les textbox
    Public Sub Clear()
        TextBoxIdClient.Text = ""
        TextBoxNom.Text = ""
        TextBoxPrenom.Text = ""
        TextBoxAdresse.Text = ""
        TextBoxCP.Text = ""
        TextBoxVille.Text = ""
        TextBoxTelPort.Text = ""
        TextBoxTelFixe.Text = ""
        TextBoxEmail.Text = ""
        TextBoxRenComp.Text = ""
        TextBoxIdIntervention.Text = ""
        TextBoxTypInt.Text = ""
        RadioButtonDepannage.Checked = False
        RadioButtonFormation.Checked = False
        RadioButtonPortable.Checked = False
        RadioButtonFixe.Checked = False
        TextBoxAutre.Text = ""
        RadioButtonDomicile.Checked = False
        RadioButtonAtelier.Checked = False
        RadioButtonDomAtel.Checked = False
        TextBoxPb.Text = ""
        TextBoxMateriel.Text = ""
        TextBoxTravaux.Text = ""

    End Sub

    Public Sub ButtonEnabledTrue()
        TextBoxIdClient.Enabled = True
        TextBoxNom.Enabled = True
        TextBoxPrenom.Enabled = True
        TextBoxAdresse.Enabled = True
        TextBoxCP.Enabled = True
        TextBoxVille.Enabled = True
        TextBoxTelPort.Enabled = True
        TextBoxTelFixe.Enabled = True
        TextBoxEmail.Enabled = True
        TextBoxRenComp.Enabled = True
        TextBoxIdIntervention.Enabled = True
        DateTimePickRecept.Enabled = True
        DateTimeDebInt.Enabled = True
        DateTimeFin.Enabled = True
        DateTimeLiv.Enabled = True
        TextBoxTypInt.Enabled = True
        RadioButtonDepannage.Enabled = True
        RadioButtonFormation.Enabled = True
        RadioButtonPortable.Enabled = True
        RadioButtonFixe.Enabled = True
        TextBoxAutre.Enabled = True
        RadioButtonDomicile.Enabled = True
        RadioButtonAtelier.Enabled = True
        RadioButtonDomAtel.Enabled = True
        TextBoxPb.Enabled = True
        TextBoxMateriel.Enabled = True
        TextBoxTravaux.Enabled = True
    End Sub

    Public Sub ButtonEnabledFalse()
        TextBoxIdClient.Enabled = False
        TextBoxNom.Enabled = False
        TextBoxPrenom.Enabled = False
        TextBoxAdresse.Enabled = False
        TextBoxCP.Enabled = False
        TextBoxVille.Enabled = False
        TextBoxTelPort.Enabled = False
        TextBoxTelFixe.Enabled = False
        TextBoxEmail.Enabled = False
        TextBoxRenComp.Enabled = False
        TextBoxIdIntervention.Enabled = False
        DateTimePickRecept.Enabled = False
        DateTimeDebInt.Enabled = False
        DateTimeFin.Enabled = False
        DateTimeLiv.Enabled = False
        TextBoxTypInt.Enabled = False
        RadioButtonDepannage.Enabled = False
        RadioButtonFormation.Enabled = False
        RadioButtonPortable.Enabled = False
        RadioButtonFixe.Enabled = False
        TextBoxAutre.Enabled = False
        RadioButtonDomicile.Enabled = False
        RadioButtonAtelier.Enabled = False
        RadioButtonDomAtel.Enabled = False
        TextBoxPb.Enabled = False
        TextBoxMateriel.Enabled = False
        TextBoxTravaux.Enabled = False
    End Sub

    Public Sub Rafraichir()
        ' Try
        Dim donnees As New Data.DataTable

        macnx.viderVue("lesClient")
        donnees = macnx.Executer_Requete_Select("Select distinct client.IdClient,intervention.idIntervention,nomClient,prenomclient,AdresseClient,CodePostalClient,VilleClient,TelPortClient,TelFixeClient,EmailClient,RenseignementCompAdresse,typeIntervention,typeMateriel,Lieu, EnonceProbleme,MaterielsDeposes,TravauxEffectues,date.DateHeureReception,date.DateHeureDebIntervention,date.DateHeureFinIntervention,date.dateHeureLivraison From client, intervention, date Where intervention.IdIntervention ='" & IdCli & "' and client.IdClient = intervention.IdCli and date.idIntervention = intervention.idIntervention", "lesClient")
        nbchamps = donnees.Rows.Count - 1
        TextBoxIdClient.Text = macnx.GetChamp_DataTable(donnees, position, 0)
        TextBoxIdIntervention.Text = macnx.GetChamp_DataTable(donnees, position, 1)
        TextBoxNom.Text = RemplaceSlashApostrophes(macnx.GetChamp_DataTable(donnees, position, 2))
        TextBoxPrenom.Text = RemplaceSlashApostrophes(macnx.GetChamp_DataTable(donnees, position, 3))
        TextBoxAdresse.Text = RemplaceSlashApostrophes(macnx.GetChamp_DataTable(donnees, position, 4))
        TextBoxCP.Text = macnx.GetChamp_DataTable(donnees, position, 5)
        TextBoxVille.Text = RemplaceSlashApostrophes(macnx.GetChamp_DataTable(donnees, position, 6))
        TextBoxTelPort.Text = macnx.GetChamp_DataTable(donnees, position, 7)
        TextBoxTelFixe.Text = macnx.GetChamp_DataTable(donnees, position, 8)
        TextBoxEmail.Text = macnx.GetChamp_DataTable(donnees, position, 9)
        TextBoxRenComp.Text = macnx.GetChamp_DataTable(donnees, position, 10)
        DateTimePickRecept.Text = macnx.GetChamp_DataTable(donnees, position, 17)
        DateTimeDebInt.Text = macnx.GetChamp_DataTable(donnees, position, 18)
        DateTimeFin.Text = macnx.GetChamp_DataTable(donnees, position, 19)
        DateTimeLiv.Text = macnx.GetChamp_DataTable(donnees, position, 20)

        TextBoxTypInt.Text = macnx.GetChamp_DataTable(donnees, position, 11)
        'TextBoxIdClient.Text = MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(0)
        'TextBoxNom.Text = RemplaceSlashApostrophes(MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(2))
        'TextBoxPrenom.Text = MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(3)
        'TextBoxAdresse.Text = RemplaceSlashApostrophes(MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(4))
        ' TextBoxCP.Text = MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(5)
        'TextBoxVille.Text = RemplaceSlashApostrophes(MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(6))
        'TextBoxTelPort.Text = MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(7).ToString
        'TextBoxTelFixe.Text = MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(8).ToString
        ' TextBoxEmail.Text = MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(9).ToString
        'TextBoxRenComp.Text = RemplaceSlashApostrophes(MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(10).ToString)
        'DateTimePickRecept.Text = MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(17)
        'DateTimeDebInt.Text = MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(18)
        'DateTimeFin.Text = MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(19)
        'DateTimeLiv.Text = MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(20)
        'TextBoxIdIntervention.Text = MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(1)
        'TextBoxTypInt.Text = MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(11)
        If TextBoxTypInt.Text = "depannage" Then
            RadioButtonDepannage.Checked = True
            RadioButtonFormation.Checked = False
        Else
            RadioButtonDepannage.Checked = False
            RadioButtonFormation.Checked = True
        End If
        '  TextBoxTypePc.Text = MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(12)
        TextBoxTypePc.Text = macnx.GetChamp_DataTable(donnees, position, 12)
        If TextBoxTypePc.Text = "portable" Then
            RadioButtonPortable.Checked = True
            RadioButtonFixe.Checked = False
            TextBoxAutre.Text = ""
        End If
        If TextBoxTypePc.Text = "fixe" Then
            RadioButtonPortable.Checked = False
            RadioButtonFixe.Checked = True
            TextBoxAutre.Text = ""
        End If
        If TextBoxTypePc.Text <> "" And Not TextBoxTypePc.Text = "fixe" And Not TextBoxTypePc.Text = "portable" Then
            RadioButtonPortable.Checked = False
            RadioButtonFixe.Checked = False
            TextBoxAutre.Text = TextBoxTypePc.Text
        End If
        TextBoxLieu2.Text = macnx.GetChamp_DataTable(donnees, position, 13)
        'TextBoxLieu2.Text = MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(13)
        If TextBoxLieu2.Text = "domicile" Then
            RadioButtonDomicile.Checked = True
            RadioButtonAtelier.Checked = False
            RadioButtonDomAtel.Checked = False
        End If

        If TextBoxLieu2.Text = "atelier" Then
            RadioButtonDomicile.Checked = False
            RadioButtonAtelier.Checked = True
            RadioButtonDomAtel.Checked = False
        End If
        If TextBoxLieu2.Text = "Domicile & Atelier" Then
            RadioButtonDomicile.Checked = False
            RadioButtonAtelier.Checked = False
            RadioButtonDomAtel.Checked = True
        End If
        TextBoxPb.Text = RemplaceSlashApostrophes(macnx.GetChamp_DataTable(donnees, position, 14))
        TextBoxMateriel.Text = RemplaceSlashApostrophes(macnx.GetChamp_DataTable(donnees, position, 15))
        TextBoxTravaux.Text = macnx.GetChamp_DataTable(donnees, position, 16)
        'TextBoxPb.Text = RemplaceSlashApostrophes(MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(14).ToString)
        'TextBoxMateriel.Text = RemplaceSlashApostrophes(MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(15).ToString)
        'TextBoxTravaux.Text = RemplaceSlashApostrophes(MonJeuDeDonnees.Tables("ModifDepannage").Rows(position).Item(16).ToString)
        ' Catch ex As InvalidCastException

        '  End Try


    End Sub

#End Region

#Region "Méthode Bouton"

    Private Sub btnImprimer_Click(sender As System.Object, e As System.EventArgs)
        PrintForm1.Print()
    End Sub

    Private Sub RadioButtonFixe_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButtonFixe.CheckedChanged
        TextBoxAutre.Text = ""
    End Sub

    Private Sub RadioButtonPortable_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButtonPortable.CheckedChanged
        TextBoxAutre.Text = ""
    End Sub

    Private Sub TextBoxAutre_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBoxAutre.TextChanged
        RadioButtonFixe.Checked = False
        RadioButtonPortable.Checked = False
    End Sub
#End Region

#Region "Fonction"

    Public Function ValidMail(ByVal adresse As String) As Boolean
        Dim myRegex As System.Text.RegularExpressions.Regex
        myRegex = New Regex("^([\w]+)@([\w]+)\.([\w]+)$")
        '([\w]+) ==> caractère alphanumérique apparaissant une fois ou plus
        Return myRegex.IsMatch(adresse) 'retourne true ou false selon la vérification
    End Function

    Private Sub TextBoxEmail_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBoxEmail.LostFocus

        If ValidMail(TextBoxEmail.Text) = False Then
            Me.ErrorProvider1.SetError(Me.TextBoxEmail, "L'adresse E-Mail est invalide : @ ou . malplacés ou absents !!!")
        Else
            Me.ErrorProvider1.SetError(Me.TextBoxEmail, "")
        End If
    End Sub

    Public Function RemplaceApostrophesSlash(ByRef unechaine As String) As String
        Dim ch As String
        ch = unechaine.Replace("'", "/")
        Return ch
    End Function


    Public Function RemplaceSlashApostrophes(ByRef unechaine As String) As String
        Dim ch As String
        ch = unechaine.Replace("/", "'")
        Return ch
    End Function

    Public Function RemplaceSlashApostrophesDataTable(ByRef lesdonnees As DataTable)
        Dim nblignes As Integer
        Dim nbcolonnes As Integer
        Dim test As String = ""
        nblignes = lesdonnees.Rows.Count
        nbcolonnes = lesdonnees.Columns.Count
        Dim i, j As Integer
        For i = 0 To nblignes - 1
            For j = 0 To nbcolonnes - 1
                'Attention le replace ne s'applique qu'aux type String : utilisation de la classe de base Object :
                If Object.ReferenceEquals(lesdonnees.Rows(i).Item(j).GetType(), test.GetType()) Then
                    lesdonnees.Rows(i).Item(j) = RemplaceSlashApostrophes(lesdonnees.Rows(i).Item(j))
                End If
            Next
        Next
        Return lesdonnees
    End Function
#End Region

    Private Sub btnModif_Click(sender As System.Object, e As System.EventArgs) Handles btnModif.Click
        btnModif.BackColor = Color.Green
        LblinfoModif.ForeColor = Color.Green
        LblinfoModif.Text = "Après avoir modifié, cliquez sur Valider! --->"
        Try
            If btnModif.Text = "Modif" Then
                ButtonEnabledTrue()
                btnModif.Text = "Valider!"
            Else
                If TextBoxNom.Text <> "" Then
                    DateTimeDebInt.CustomFormat = "yyyy-MM-dd HH:mm:ss"
                    DateTimeLiv.CustomFormat = "yyyy-MM-dd HH:mm:ss"
                    DateTimeFin.CustomFormat = "yyyy-MM-dd HH:mm:ss"
                    DateTimePickRecept.CustomFormat = "yyyy-MM-dd HH:mm:ss"
                    idc = CInt(TextBoxIdClient.Text)
                    nom = RemplaceApostrophesSlash(TextBoxNom.Text)
                    pre = TextBoxPrenom.Text
                    email = TextBoxEmail.Text
                    rue = RemplaceApostrophesSlash(TextBoxAdresse.Text)
                    vil = RemplaceApostrophesSlash(TextBoxVille.Text)
                    cp = TextBoxCP.Text
                    telpor = TextBoxTelPort.Text
                    telfixe = TextBoxTelFixe.Text
                    rencomp = RemplaceApostrophesSlash(TextBoxRenComp.Text)
                    dtAp = DateTimePickRecept.Text
                    dtDI = DateTimeDebInt.Text
                    dtFI = DateTimeFin.Text
                    dtLi = DateTimeLiv.Text
                    idi = TextBoxIdIntervention.Text
                    If (RadioButtonDepannage.Checked) Then
                        typInterv = "depannage"

                    End If
                    If (RadioButtonFormation.Checked) Then
                        typInterv = "formation"

                    End If
                    If (RadioButtonPortable.Checked) Then
                        typPC = "portable"
                        TextBoxAutre.Text = ""
                    End If
                    If (RadioButtonFixe.Checked) Then
                        typPC = "fixe"
                        TextBoxAutre.Enabled = True
                    End If
                    If (TextBoxAutre.Text <> "") Then
                        typPC = TextBoxAutre.Text
                        RadioButtonFixe.Checked = False
                        RadioButtonPortable.Checked = False
                    End If

                    If (RadioButtonDomicile.Checked) Then
                        lieu = "domicile"

                    End If
                    If (RadioButtonAtelier.Checked) Then
                        lieu = "atelier"
                    End If
                    If (RadioButtonDomAtel.Checked) Then
                        lieu = "Domicile & Atelier"
                    End If

                    pb = RemplaceApostrophesSlash(TextBoxPb.Text)
                    mat = RemplaceApostrophesSlash(TextBoxMateriel.Text)
                    tra = RemplaceApostrophesSlash(TextBoxTravaux.Text)
                    'Requete update qui modifie le client l'intervention et la date d'un dépannage 
                    macnx.Se_Connecter_MySqlServer()
                    macnx.Executer_Requete_Action("update date Set DateHeureDebIntervention ='" & dtDI & "',  DateHeureFinIntervention ='" & dtFI & "', DateHeureLivraison ='" & dtLi & "' where idIntervention=" & idi & " and idCli = " & idc & " and DateHeureReception = '" & dtAp & "';update intervention Set TypeIntervention = '" & typInterv & "', TypeMateriel ='" & typPC & "',  Lieu ='" & lieu & "', EnonceProbleme ='" & pb & "', MaterielsDeposes ='" & mat & "', TravauxEffectues = '" & tra & "', IdCli = " & idc & " where IdIntervention=" & idi & "; update Client Set NomClient = '" & nom & "', PrenomClient ='" & pre & "',  AdresseClient ='" & rue & "', CodePostalClient ='" & cp & "', VilleClient ='" & vil & "', TelPortClient = '" & telpor & "', TelFixeClient = '" & telfixe & "',  EmailClient = '" & email & "', RenseignementCompAdresse = '" & rencomp & "' where IdClient=" & idc & ";")
                    macnx.Se_Deconnecter_MySqlServer()
                    MessageBox.Show("Depannage Modifié...!", "Alerte!", MessageBoxButtons.OK, MessageBoxIcon.Information)
                    btnModif.Text = "Modif"
                    btnModif.BackColor = Color.Red
                    LblinfoModif.ForeColor = Color.Red
                    LblinfoModif.Text = "Avant toute modification , cliquez sur Modif --->"
                    DateTimeDebInt.CustomFormat = "dd-MM-yyyy HH:mm:ss"
                    DateTimeLiv.CustomFormat = "dd-MM-yyyy HH:mm:ss"
                    DateTimeFin.CustomFormat = "dd-MM-yyyy HH:mm:ss"
                    DateTimePickRecept.CustomFormat = "dd-MM-yyyy HH:mm:ss"
                    ' Clear()
                    ButtonEnabledFalse()
                    ' TextBoxId.Text = "0"
                End If
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub BtnSupp_Click(sender As System.Object, e As System.EventArgs) Handles BtnSupp.Click
        Try
            If BtnSupp.Text = "Supp" Then
                ButtonEnabledTrue()

                If TextBoxNom.Text <> "" Then
                    
                    idc = CInt(TextBoxIdClient.Text)
                    idi = CInt(TextBoxIdIntervention.Text)
                    dtAp = DateTimePickRecept.Text
                    'Requete delete qui supprime toutes les informations de l'intervention d'un client 
                    macnx.Se_Connecter_MySqlServer()
                    macnx.Executer_Requete_Action("Delete from date Where idIntervention = '" & idi & "'; Delete from Intervention Where idIntervention = " & idi & ";")
                    macnx.Se_Deconnecter_MySqlServer()
                    MessageBox.Show("Bon Supprimé...!", "Alerte!", MessageBoxButtons.OK, MessageBoxIcon.Information)
                    Clear()
                    ButtonEnabledFalse()
                    TextBoxId.Text = "0"
                    
                End If
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
        BtnSupp.Text = "Supp"
    End Sub

    Private Sub BtnFermer_Click(sender As System.Object, e As System.EventArgs) Handles BtnFermer.Click
        Me.Close()
    End Sub


    Private Sub FrmModifDepannage_FormClosing(sender As System.Object, e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing

    End Sub

    Private Sub TextBoxId_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBoxId.TextChanged
        If TextBoxId.Text = "0" Then
            'TextBoxIdClient.Text = ""
            'TextBoxNom.Text = ""
            'TextBoxPrenom.Text = ""
            'TextBoxAdresse.Text = ""
            'TextBoxCP.Text = ""
            'TextBoxVille.Text = ""
            'TextBoxTelPort.Text = ""
            'TextBoxTelFixe.Text = ""
            'TextBoxEmail.Text = ""
            'TextBoxRenComp.Text = ""
            'TextBoxIdIntervention.Text = ""
            'TextBoxTypInt.Text = ""
            'RadioButtonDepannage.Checked = False
            'RadioButtonFormation.Checked = False
            'RadioButtonPortable.Checked = False
            'RadioButtonFixe.Checked = False
            'TextBoxAutre.Text = ""
            'RadioButtonDomicile.Checked = False
            'RadioButtonAtelier.Checked = False
            'RadioButtonDomAtel.Checked = False
            'TextBoxPb.Text = ""
            'TextBoxMateriel.Text = ""
            'TextBoxTravaux.Text = ""
        Else
            Try
                IdCli = TextBoxId.Text
            Catch ex As InvalidCastException
            End Try
            macnx.Se_Connecter_MySqlServer()
            ' MaRequete = "Select client.IdClient,intervention.idIntervention,nomClient,prenomclient,AdresseClient,CodePostalClient,VilleClient,TelPortClient,TelFixeClient,EmailClient,RenseignementCompAdresse,typeIntervention,typeMateriel,Lieu, EnonceProbleme,MaterielsDeposes,TravauxEffectues, date.DateHeureReception,date.DateHeureDebIntervention,date.DateHeureFinIntervention,date.dateHeureLivraison From client, intervention, date, depannage Where intervention.IdIntervention ='" & IdCli & "' and client.IdClient = depannage.IdClient And depannage.idIntervention = intervention.idIntervention And Date.idCli = client.idClient and date.dateHeureReception = depannage.dateHeureReception "
            Rafraichir()
            macnx.Se_Deconnecter_MySqlServer()
        End If
    End Sub

    Private Sub BtnRecapModif_Click(sender As System.Object, e As System.EventArgs) Handles BtnRecapModif.Click
        FrmRecapModifDep.Show()
        FrmTravauxEffectues.Show()
    End Sub

    Private Sub TextBoxIdIntervention_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBoxIdIntervention.TextChanged
        Try

            idinter = TextBoxIdIntervention.Text
            macnx.Se_Connecter_MySqlServer()
            macnx.viderVue("NomTrav")
            DataGridTravauxEff.DataSource = RemplaceSlashApostrophesDataTable(macnx.Executer_Requete_Select("select NomTravaux from travauxeffectues where idintervention = " & idinter & " ", "NomTrav"))
            DataGridTravauxEff.AutoResizeColumns()
            DataGridTravauxEff.ForeColor = Color.Black
            macnx.Se_Deconnecter_MySqlServer()

        Catch ex As Exception

        End Try
    End Sub

  
End Class